home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / filutil / mdf130.zip / MDFL130.ZIP / CPPSAMP.ZIP / MPATCH.H next >
C/C++ Source or Header  |  1995-01-12  |  2KB  |  80 lines

  1.  
  2.  
  3. #ifndef _MPATCH_H_
  4. #define _MPATCH_H_
  5.  
  6.             /* MDF - Algorithm version: 1.30 */
  7.  
  8. #ifndef CMTSIZE
  9. #define CMTSIZE        2048
  10. #endif
  11.  
  12.  
  13. #ifdef __cplusplus
  14. // C++ Mpatch class
  15. class MPatch    {
  16.  
  17.      unsigned long UnRegCrc;
  18.      char *FileBuffer;
  19.      short error;
  20.      char Doldfile[256];
  21.      char Dnewfile[256];
  22.      char Name[256];
  23.      char Comment[CMTSIZE];
  24.      unsigned long rate;
  25.  
  26.      short Patch(FILE *fold,FILE *fnew,FILE *fdiff);
  27.  
  28.     public:
  29.  
  30.      MPatch();
  31.  
  32.      void SetRate(short r=10);
  33.      short MDFPatch(char *diffile, char *oldfile, char *newfile);
  34.      char *LastError();
  35.      virtual void Show_start();
  36.      virtual void Show();
  37.      virtual void Show_end();
  38. };
  39. #endif
  40.  
  41. // *.MDF header info structure
  42. struct MDF_header_info
  43.     {
  44.      char alg_ver[4];          // Algorithm version
  45.      char oldfilename[256];    // Old file name stored in MDF
  46.      char newfilename[256];    // New file name stored in MDF
  47.      char registeredto[256];   // Registered to
  48.      char comment[CMTSIZE];    // Comment stored in MDF
  49.      unsigned long oldfilecrc; // Old file CRC-32
  50.      short chunk_len;           // Chunk lenght
  51.      unsigned long n_chunks;   // Number of chunks
  52. };
  53.  
  54. #ifdef __cplusplus
  55. extern "C" {
  56. #endif
  57. // C/C++ header read function
  58. short readMDFhead(char *fn,struct MDF_header_info *hi);  // Reads header from fn file
  59. // Returns:
  60. //    0 = File not found
  61. //    1 = OK
  62. // -1 = Not a MDIFF file
  63. // -2 = Wrong MDF version
  64.  
  65. // C functions
  66. short MDFPatch(char *mfl,char *ofl,char *nfl);
  67. char *MDFError(short e);
  68.  
  69. #ifdef __cplusplus
  70. }
  71. #endif
  72.  
  73. #ifdef __DLL__
  74. // Windows DLL functions
  75. extern int far pascal _export MPATCH(char *fmdf,char *fold,char *fnew);
  76. extern int far pascal _export MDFHEAD(char *fn,MDF_header_info *hi);
  77. #endif
  78.  
  79. #endif
  80.